package itdep.domain.event;

import itdep.domain.IisEntity;
import org.hibernate.annotations.Filter;

import javax.persistence.*;
import java.util.Date;
import java.util.Set;

/**
 * @author lena
 * @version $Revision: 11 $ $Date: 2010-06-16 10:18:57 +0000 (Wed, 16 Jun 2010) $
 */
@Entity
@Filter(name = "existing")
@Table(name = "DIRECTIVE")
public class Directive extends IisEntity {

	@Column(name = "DIRECTIVE_NUMBER", nullable = false, insertable = true, updatable = true)
	private String directiveNumber;

	@Column(name = "DIRECTIVE_DATE", nullable = true, insertable = true, updatable = true)
	private Date directiveDate;

	/*
	* order or disposal
	* приказ или расопряжение
	 */
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "ID_DIRECTIVE_TYPE", nullable = false, insertable = true, updatable = true)
	private DirectiveType directiveType;

	@OneToMany(mappedBy = "directive", targetEntity = StudentEvent.class, cascade = {CascadeType.PERSIST, CascadeType.MERGE})
	private Set<StudentEvent> events;

	public String getDirectiveNumber() {
		return directiveNumber;
	}

	public void setDirectiveNumber(String directiveNumber) {
		this.directiveNumber = directiveNumber;
	}

	public Date getDirectiveDate() {
		return directiveDate;
	}

	public void setDirectiveDate(Date directiveDate) {
		this.directiveDate = directiveDate;
	}

	public Set<StudentEvent> getEvents() {
		return events;
	}

	public void setEvents(final Set<StudentEvent> events) {
		this.events = events;
	}

	public DirectiveType getDirectiveType() {
		return directiveType;
	}

	public void setDirectiveType(final DirectiveType directiveType) {
		this.directiveType = directiveType;
	}
}